package com.Maykk.Demo03;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @ClassName: Demo04
 * @Description: TODO Iterator 迭代器练习
 * @Author: MaykkStar@163.com
 */
public class Demo03 {
    public static void main(String[] args) {
        ArrayList<Student> stuList = new ArrayList<>();
        stuList.add(new Student("张三", "男", 300));
        stuList.add(new Student("李四", "男", 300));
        stuList.add(new Student("王五", "男", 300));
        stuList.add(new Student("赵六", "女", 300));
        for (Student stu : stuList) {
            System.out.println(stu);
        }
        System.out.println("+++++++++++++++++++++++");
        Iterator<Student> it = stuList.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
    }
}
